# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 这不是一个自由软件,商业使用请先取得授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from fastapi import APIRouter, Depends
from hypertext import R, response_json
from apps.admin.schemas.setting.ai import models_schema as schema
from apps.admin.service.setting.ai.models_service import AiModelsService

router = APIRouter(prefix="/models", tags=["模型配置"])


@router.get("/channel", summary="模型渠道", response_model=R[schema.AiModelsChannelVo])
@response_json
async def channel():
    return await AiModelsService.channel()


@router.get("/lists", summary="模型列表", response_model=R[schema.AiModelsListVo])
@response_json
async def lists(params: schema.AiModelsSearchIn = Depends()):
    return await AiModelsService.lists(params.scene)


@router.get("/detail", summary="模型详情")
@response_json
async def detail(params: schema.AiModelsDetailIn = Depends()):
    return await AiModelsService.detail(params.id)


@router.post("/add", summary="模型创建", response_model=R)
@response_json
async def add(params: schema.AiModelsAddIn):
    return await AiModelsService.add(params)


@router.post("/edit", summary="模型编辑", response_model=R)
@response_json
async def edit(params: schema.AiModelsEditIn):
    return await AiModelsService.edit(params)


@router.post("/delete", summary="模型删除", response_model=R)
@response_json
async def delete(params: schema.AiModelIdIn):
    return await AiModelsService.delete(params.id)


@router.post("/disable", summary="模型停用")
@response_json
async def disable(params: schema.AiModelIdIn):
    return await AiModelsService.disable(params.id)

